package com.hluck.goodweatherapp.data.network.api;

import com.hluck.goodweatherapp.data.Constant;
import com.hluck.goodweatherapp.data.bean.AirResponse;
import com.hluck.goodweatherapp.data.bean.BingResponse;
import com.hluck.goodweatherapp.data.bean.HourlyResponse;
import com.hluck.goodweatherapp.data.bean.LocationData;
import com.hluck.goodweatherapp.data.bean.WeatherData;
import com.hluck.goodweatherapp.data.bean.WeatherIndexResponse;
import com.hluck.goodweatherapp.data.bean.WeekWeather;

import io.reactivex.Observable;
import io.reactivex.Observer;
import retrofit2.http.GET;
import retrofit2.http.Query;

/**
 * @Author： LJH
 * @Time： 2023/12/27
 * @description：
 */
public interface ApiService {

    /**
     * 搜索城市  模糊搜索，国内范围 返回10条数据
     *
     * @param location 城市名
     * @param mode     exact 精准搜索  fuzzy 模糊搜索
     * @return LocationData 搜索城市数据返回
     */
    @GET("/v2/city/lookup?key="+ Constant.API_KEY+"&range=cn")
    Observable<LocationData> searchCity(@Query("location")String location, @Query("mode")String mode);


    /**
     * 查询某地的天气
     * @param location
     * @return
     */
    @GET("/v7/weather/now?key=" + Constant.API_KEY)
    Observable<WeatherData> nowWeather(@Query("location")String location);


    /**
     * 查询7天的天气
     * @param location
     * @return
     */
    @GET("/v7/weather/7d?key=" + Constant.API_KEY)
    Observable<WeekWeather> dailyWeather(@Query("location")String location);


    /**
     *
     * @param type
     * @param location
     * @return
     */
    @GET("/v7/indices/1d?key=" + Constant.API_KEY)
    Observable<WeatherIndexResponse> lifeStyle(@Query("type")String type, @Query("location")String location);

    /**
     * 逐小时天气api
     * @param location
     * @return
     */
    @GET("/v7/weather/24h?key="+Constant.API_KEY)
    Observable<HourlyResponse> hourWeather(@Query("location")String location);


    /**
     * 必应每日一图
     *
     * @return BiYingImgResponse 必应壁纸返回
     */
    @GET("/HPImageArchive.aspx?format=js&idx=0&n=1")
    Observable<BingResponse> bing();


    @GET("/v7/air/now?key=" + Constant.API_KEY)
    Observable<AirResponse> airWeather(@Query("location") String location);
}
